<%--
  Created by IntelliJ IDEA.
  User: ZhuChunXiao
  Date: 2017/5/26
  Time: 14:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<div id="page-content">
  <div class="row">

    <div class="col-lg-12">
      <div class="panel">
        <%--<div class="panel-heading">--%>
          <%--<h3 class="panel-title">培训管理</h3>--%>
        <%--</div>--%>
        <div class="panel-body">
          <input type="hidden" id="parentId6" value="${parentId}">

          <div class="table-jqgrid" >
            <table id="train_in_table"></table>
            <div id="train_in_page"></div>
          </div>
        </div>

        <div class="panel-footer">
          <a class="btn btn-default" id="apply-re-common6" href="javascript:void(0)">
            <i class="fa fa-lg fa-mail-reply"></i> 返回视图
          </a>
        </div>
      </div>
    </div>

  </div>
</div>

<script>

  $(function(){

    init_grid_train();
    jQuery("#train_in_table").jqGrid('setGridWidth',  $('div').data("table_global_width")-66);

  });

  function init_grid_train() {

    __init_jqgrid('train_in_table', 'train_in_page',
            '<%=path%>/com/train/list?parentId='+$("#parentId6").val(),
            ['培训主题', '培训类型', '培训周期', '提交日期', '文档状态', '操作', 'id'],
            [
              {name: 'theme', index: 'theme', width: 60, sortable: false, search: true, searchoptions: {sopt: ['cn']}},
              {name: 'type', index: 'type_name', width: 80, sortable: true, search: true, stype: 'text', searchoptions: {sopt: ['cn']}},
              {name: 'date', index: 'date', width: 100, sortable: true, search: true, searchoptions: {sopt: ['cn']}},
              {name: 'createTime', index: 'createTime', width: 80, sortable: true, search: true, searchoptions: {sopt: ['cn']}},
              {name: 'state', index: 'state', width: 60, sortable: true, search: true, searchoptions: {sopt: ['cn']}},
              {name: 'act', index: 'act', width: 100, fixed: true, sortable: false, search: false, formatter: actFormat},
              {name: 'id', index: 'id', width: 60, key: true, hidden: true, hidedlg: true}
            ],
            true,true
    );

  }

  function actFormat(cellvalue, options, rowObject){
    var id = rowObject.id;
    cellvalue = '<button class="btn btn-white btn-sm" data-original-title="查看" onclick="fn_train_read(\'' + id + '\');"><i class="fa fa-eye"> </i> 查看</button>';

    return cellvalue;
  }

  function fn_train_read(id) {
    loadURL('<%=path%>/com/train/read?keyId='+id, $('#s6'));
  }

  //返回视图
  $("#apply-re-common6").click(returnToHashUrl);

</script>